﻿@using System.Globalization
@model ProductDetailsModel
@inject SeoSettings seoSettings
<div>
    @if (Model.Parameters.Any())
    {
        <div class="container" style="margin-left:-15px">
            <label for="parameterDropdown" class="col-form-label">@Loc["Products.AdditionalParameter"]:</label>
            <select class="custom-select form-control" name="parameterDropdown" id="parameterDropdown">
                @foreach (var parameter in Model.Parameters)
                {
                    <option value="@parameter.Value">@parameter.Text</option>
                }
            </select>
        </div>
    }

    @if (Model.IntervalUnit == IntervalUnit.Day)
    {
        <div>
            <h5>@Loc["Products.Reservation.DateFrom"]:</h5>
            <input name="reservationDatepickerFrom" id="reservationDatepickerFrom" class="form-control datepicker"/>
        </div>
        <div>
            <h5>@Loc["Products.Reservation.DateTo"]:</h5>
            <input name="reservationDatepickerTo" id="reservationDatepickerTo" class="form-control datepicker"/>
        </div>
    }
    else
    {
        <div>
            <h5>@Loc["Products.Reservation.Date"]:</h5>
            <input id="reservationDatepicker" class="form-control datepicker"/>
        </div>
        <div>
            <h5 style="margin-top:10px">@Loc["Products.Reservation.Hour"]:</h5>
            <div id="hoursDiv" class="d-inline-flex flex-wrap" data-toggle="buttons"></div>
        </div>
    }
</div>

<script asp-location="Footer" asp-order="300">
    document.addEventListener("DOMContentLoaded", function () {
        Reservation.init("@Model.StartDate.ToString("d", CultureInfo.CreateSpecificCulture("en-US"))", "@Model.StartDate.Year", "@Model.StartDate.Month", "@Loc["Products.Noavailablereservations"]",
            "@(Url.Action("GetDatesForMonth", "Product"))", "@Model.Id",
            "@Html.Raw(Url.Action("productdetails_attributechange", "product", new { productId = Model.Id }))");
    });
</script>